<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
   <title>佐心，教家长做父母</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
	<c:set var="ctx" value="${pageContext.request.contextPath}" />
    <link rel="stylesheet" href="${ctx}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="${ctx}/assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="${ctx}/assets/css/index.css?v=2.3">
    <script>
    	    /** 
     * 返回前一页（或关闭本页面） 
     * <li>如果没有前一页历史，则直接关闭当前页面</li> 
     */  
    function goBack(){  
        if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)){ // IE  
            if(history.length > 0){  
                window.history.go( -1 );  
            }else{  
                location.href="${ctx}/index.jsp";
            }  
        }else{ //非IE浏览器  
            if (navigator.userAgent.indexOf('Firefox') >= 0 ||  
                navigator.userAgent.indexOf('Opera') >= 0 ||  
                navigator.userAgent.indexOf('Safari') >= 0 ||  
                navigator.userAgent.indexOf('Chrome') >= 0 ||  
                navigator.userAgent.indexOf('WebKit') >= 0){  
      
                if(window.history.length > 1){  
                    window.history.go( -1 );  
                }else{  
                    location.href="${ctx}/index.jsp";
                }  
            }else{ //未知的浏览器  
                window.history.go( -1 );  
            }  
        }  
    }  
    </script>
</head>
<body class="bg-gray">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a  onclick="goBack();"  >
            <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        问题详情
    </h1>

</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">

    <div class="bg-white am-padding-top-sm am-padding-bottom-xs">

        <!--<div class="am-g ">-->
            <!--<div class="am-u-sm-7">咨询领域：亲子关系</div>-->
            <!--<div class="am-u-sm-5 font-12 font-color-15 am-text-right padding-top-3px">2015-7-30 08:00</div>-->


        <!--</div>-->

        <div class="box am-container">
            <div class="width-40px"><div class="icon_71"></div></div>
            <div class="font-color-13 box-1">咨询领域：${freeAsk.direction }</div>
            <div class="font-12 font-color-15 am-text-right padding-top-3px width-180px">${freeAsk.askTimeStr }</div>
        </div>

        <!-- 问题描述-->
        <div class="icon_26 am-text-center font-color-12 margin-top-15 ">
            问题描述
        </div>
        <div class="am-padding-bottom-sm">
            <div class="am-container font-color-13 font-14 am-margin-top-sm">
				<c:if test="${freeAsk.type==0}">
            			${freeAsk.question}
            	</c:if>
            	<c:if test="${freeAsk.type==1}">
            		<div class='btn_18 voice' >
		 			<input type='hidden' value="${freeAsk.question}">
		            <i class='icon_711 '></i><span></span>
		            </div>
            	</c:if>
            </div>
        </div>

        <div class=" bg-gray am-margin-left-sm am-margin-right-sm ">
            <div class="am-g   am-padding-top-sm border-1">

                <div class=" am-u-sm-12 am-list-main box  am-padding-bottom-xs">
                    <div class="width-60px">
                        <a class="">
                            <img class="img-50" src="${ctx}/assets/images/upload/pic.png"/>
                        </a>
                        <i class="icon_12"></i>
                    </div>
                    <div class="box-1">
                        <div class="am-list-item-hd font-color-13 font-15">
                            <span>${counselor.counseName}</span>
                        </div>

                        <div class="font-14  font-color-15 margin-top-3">
                            ${freeAsk.pingjiaTimeStr}
                        </div>
                    </div>
                </div>
                <div class="am-u-sm-12 font-14 am-padding-bottom-sm ">
                   <c:if test="${isYuyin==0}">
            			${freeAsk.counseAnswer}
            	</c:if>
            	<c:if test="${isYuyin==1}">
            		<div class='btn_18 voice' >
		 			<input type='hidden' value="${freeAsk.counseAnswer}">
		            <i class='icon_711 '></i><span></span>
		            </div>
            	</c:if>
                </div>
                <div class="am-u-sm-12 am-padding-left-2sm am-padding-right-2sm">
                    <div class="am-g border-tops am-padding-top-sm am-padding-bottom-sm ">
                        <div class="am-u-sm-6  font-15 am-text-center border-right padding-left-20" id="shouchang">
                            <span class="prelative"><i class="icon_41"></i>收藏</span>
                        </div>
                        <div class="am-u-sm-6  font-15 am-text-center padding-left-20">
                          <c:if test="${freeAsk.status!=2}">
                          <a href="pingjia.jsp?askId=${freeAsk.id}">  <span class="prelative font-color-13"><i class="icon_40 "></i>评价</span></a>
                          </c:if>
                          <c:if test="${freeAsk.status==2}">
                          <span class="prelative font-color-13"><i class="icon_40 "></i>已评价</span>
                          </c:if>
                        </div>
                    </div>
                </div>


            </div>
        </div>

        <!--培训评价-->
        <div class="icon_24 am-text-center font-color-15">
            用户评价
        </div>
         <c:if test="${freeAsk.status==1}">
         <div class="icon_55"></div>
            <div class="am-text-center font-14 font-color-15">暂无评论，快点击评论按钮，抢沙发吧！</div>
        </c:if> 
         <c:if test="${freeAsk.status==2}">
        <div class="mark_list">

            <div class="am-list-news am-list-news-default ">

                <div class="am-list-news-bd am-margin-left-sm am-margin-right-sm">
                    <ul class="am-list">
                        <li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left">

                            <div class=" am-u-sm-12 am-list-main font-14 box">

                                <div class="width-60px">
                                    <a class="">
                                        <img class="img-50" src="${wxUser.headimgurl}"/>
                                    </a>
                                </div>
                                <div class="box-1 margin-top-5">
                                    <h3 class="am-list-item-hd font-color-main">
                                        <div class="am-g am-g-collapse">
                                            <div class="am-u-sm-8"><span
                                                    class="font-color-13 font-15 font-bold">${wxUser.nickname}</span>
                                            </div>
                                            <div class="am-u-sm-4 font-color-16  padding-top-2pxs am-text-right">
                                                ${freeAsk.pingjiaTimeStr}
                                            </div>
                                        </div>
                                    </h3>
                                    <div class="font-14 font-color-13 ">
                                        <span class="am-fl font-color-15">评分：</span>
                                        <c:if test="${freeAsk.pingjiaxx==1}">
                                         	<i class="star-cur"></i>
                                        </c:if>
                                        <c:if test="${freeAsk.pingjiaxx==2}">
                                         	<i class="star-cur"></i>
                                         	 <i class="star-cur"></i>
                                        </c:if>
                                        <c:if test="${freeAsk.pingjiaxx==3}">
                                         	<i class="star-cur"></i>
                                         	 <i class="star-cur"></i>
                                         	 <i class="star-cur"></i>
                                        </c:if>
                                        <c:if test="${freeAsk.pingjiaxx==4}">
                                         	<i class="star-cur"></i>
                                         	 <i class="star-cur"></i>
                                         	 <i class="star-cur"></i>
	                                        <i class="star-cur"></i>
                                        </c:if>
                                        <c:if test="${freeAsk.pingjiaxx==5}">
                                         	<i class="star-cur"></i>
	                                        <i class="star-cur"></i>
	                                        <i class="star-cur"></i>
	                                        <i class="star-cur"></i>
	                                        <i class="star-cur"></i>
                                        </c:if>
                                    </div>

                                </div>

                            </div>
                            <div class=" am-u-sm-12 am-list-main font-14 font-color-15 am-margin-top-xs">
                                ${freeAsk.pingjia}
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    </c:if>
<!--隐藏音频-->
    <div class="am-hide">
        <audio src=""  id="audio">亲 您的浏览器不支持html5的audio标签</audio>
    </div>
</section>


<div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
    <div class="am-modal-dialog">
        <div class="am-modal-hd">评论</div>
        <div class="am-modal-bd">
            <textarea rows="3" class="mark_content am-modal-prompt-input">
            </textarea>
        </div>
        <div class="am-modal-footer">
            <span class="am-modal-btn" data-am-modal-cancel>取消</span>
            <span class="am-modal-btn" data-am-modal-confirm>提交</span>
        </div>
    </div>
</div>

<script src="${ctx}/assets/js/jquery.min.js"></script>
<script src="${ctx}/assets/js/amazeui.min.js"></script>
<script>
    $(function () {
    
    	var aaaStr=$.ajax({url:"isShouchang2?tel=${freeAsk.askCounseTel}",async:false});
        var shouJson=JSON.parse(aaaStr.responseText);
        if(shouJson.resultCode==1){
        	$("#shouchang").find("i.icon_41").addClass("cur");
        }
    
        $('#btnmark').on('click', function () {
            $('#my-prompt').modal({
                relatedTarget: this,
                onConfirm: function (e) {
                    alert('你输入的是：' + e.data || '')
                },
                onCancel: function (e) {
//                    alert('不想说!');
                }
            });
        });


        $("#shouchang").on('click', function () {
            var baseResponse2=$.ajax({url:"goShouchang2?tel=${freeAsk.askCounseTel}",async:false});
		  	var isShouchang=JSON.parse(baseResponse2.responseText);
			if(isShouchang.resultCode=="0"){
	            if($(this).find("i.icon_41").hasClass("cur")){
                $(this).find("i.icon_41").removeClass("cur");
	            }else{
	                $(this).find("i.icon_41").addClass("cur");
	            }
		   	}
        });
        
        $(".voice").on("click",function(){
            var audio = document.getElementById("audio");
            audio.src=$(this).find("input").val(); 
            var eventTester = function(e){
                audio.addEventListener(e,function(){
                    $voices.removeClass("cur");
                },false);
            };
            eventTester("ended");
          var $voices= $(this).find(".icon_711");
            $(".report_item .voice").find(".icon_711").remove("cur");
            if($voices.hasClass("cur")){
                $voices.removeClass("cur");
                audio.pause();
            }else{
                $voices.addClass("cur");
                audio.play();
            }

        });
    });
</script>
</body>
</html>